home *** CD-ROM | disk | FTP | other *** search
-
- =======================================================================
- =======================================================================
- ========================== ===========================
- ========================== ===========================
- ========================== FORAGE ===========================
- ========================== ===========================
- ========================== ===========================
- =======================================================================
- =======================================================================
-
-
-
- "ForAge" -- A Utility to Process Files by "Newest" or "Oldest"
- Comes with a sample application - a handy quick backup utility
-
-
- The FORAGE ("For Age") program is Copyright (C) 1992, 1994 by:
-
- Pinnacle Software, C-P 386 Mount Royal, Quebec, Canada H3P 3C6
- U.S. Office: Box 714 Airport Road, Swanton, Vermont 05488 USA
-
- Support Line: (514) 345-9578 -- Free Files BBS: (514) 345-8654
-
-
-
- --------------------------------------------------------------
- This is a SHAREWARE product. That means we would like you to
- pass around unregistered copies to other people. If you have
- a modem, please upload it to your favourite bulletin board
- system, or give a copy to a friend whom you think might need
- a program like this. Shareware means sharing! Pass it on!
- --------------------------------------------------------------
-
-
-
- ============================================================================
- OVERVIEW
- ============================================================================
-
- FORAGE lets you find the name of the newest (or oldest) file in a directory,
- and pass that name to a DOS command. This may not be something you have to
- do every day, but when you need to do it, you'll discover that DOS doesn't
- provide a convenient method to do that kind of thing. Usually you end up
- doing a DIR (sorted by date, perhaps) and reading through it until you find
- the file you want. But so many jobs are date-and time-dependant that we
- need a utility like FORAGE to let us automate these tasks.
-
- TO INSTALL FORAGE: Copy all of the files in the FORAGE package to a
- directory that is located in your DOS PATH. For details about the PATH
- command, consult your DOS manual.
-
-
- ============================================================================
- HOW FORAGE WORKS
- ============================================================================
-
- NOTE: This tutorial assumes you understand the use of wildcards in file
- masks. For example, the DOS command DIR *.DAT uses the "*" wildcard
- character to show a directory of all files with a DAT extension. For
- more details about wildcards, consult your DOS manual.
-
- FORAGE is a DOS command which accepts command-line parameters. The simplest
- application is as follows:
-
- FORAGE N *.*
-
- When you type this command at the DOS prompt, FORAGE tells you the name of
- the newest file in the current directory. (Later on, we'll see how you can
- pass that filename to another DOS command.)
-
- The "N" stands for "Newest". You can replace it with "O", as follows:
-
- FORAGE O *.*
-
- This would tell you the name of the oldest file in the current directory.
-
- If you also needed to know the size of the oldest file, you could have
- FORAGE call the DIR command, as follows:
-
- FORAGE O *.* DIR
-
- One frequent requirement in business is to move old data to a diskette.
- You can copy the oldest file to a diskette as follows:
-
- FORAGE O *.* COPY @@ A:
-
- The @@ means "the file you found". If @@ is not specified, it is assumed
- that it goes at the end of the command. Thus, the following two commands
- are equivalent:
-
- FORAGE N *.* DIR
- FORAGE N *.* DIR @@
-
- Getting back to the example of saving old data to a diskette, you'll find
- that operations of that nature are very easy to do when you use FORAGE in
- a batch (.BAT) file. For a detailed example, refer to the section entitled
- "SAMPLE BATCH FILES".
-
- Some additional examples are given later on. See "MORE EXAMPLES".
-
-
- ============================================================================
- COMMAND DEFINITION
- ============================================================================
-
- The FORAGE command uses the following command formats:
-
- FORAGE age mask
- FORAGE age mask command
- FORAGE age mask command pre-fname
- FORAGE age mask command @@ post-fname
- FORAGE age mask command pre-fname @@ post-fname
-
- In standard notation, the formal definition is as follows:
-
- FORAGE age mask [ command [pre-fname] @@ [post-fname] ]
-
- The parameters are:
-
- age Age specification, either [N]ewest or [O]ldest You can use the
- full word, but only the first letter is checked.
-
- mask File mask, using wildcards, to set the range of files to check.
- For example, *.DAT checks all files with an extension of DAT.
- For details about wildcards, consult your DOS manual.
-
- command DOS command (fully qualified, or in current PATH).
- If none is given, reports the name of file on console.
-
- pre-fname Command-line parameters to pass BEFORE the filename.
-
- @@ Indicates where the filename goes when calling the command.
- If @@ is not specified, the filename is assumed to go last.
-
- post-fname Command-line parameters to pass AFTER the filename.
-
- FORAGE has a built-in help screen available. To display it, enter the
- following command at the DOS prompt: FORAGE /?
-
-
- ============================================================================
- MORE EXAMPLES
- ============================================================================
-
- EXAMPLE: FORAGE /?
- FUNCTION: Displays two help screens, explaining how to use FORAGE
-
- EXAMPLE: FORAGE O *.*
- FUNCTION: Displays the name of the oldest file in the directory
-
- EXAMPLE: FORAGE N *.*
- FUNCTION: Displays the name of the newest file in the directory
-
- EXAMPLE: FORAGE N C:\DOS\*.*
- FUNCTION: Displays the name of the newest file in the directory C:\DOS\
-
- EXAMPLE: FORAGE N C:\DOS\*.EXE
- FUNCTION: Displays the name of the newest EXE file in the directory C:\DOS\
-
- EXAMPLE: FORAGE O *.DAT DEL
- FUNCTION: Deletes the oldest file in the directory with a DAT extension
-
- EXAMPLE: FORAGE O \DATA\*.DAT DEL
- FUNCTION: Deletes oldest DAT file in \DATA\ directory of the current drive
-
- EXAMPLE: FORAGE N C:\TEXT\*.TXT MYBATCH.BAT
- FUNCTION: Passes the name of the newest TXT file in C:\TEXT\ to the batch
- file MYBATCH.BAT (where it is accessible as the symbol %1)
-
- EXAMPLE: FORAGE O *.DAT C:\MYPGMS\COPYOLD.EXE /v @@ /d/r
- FUNCTION: Passes the name of the oldest DAT file to the COPYOLD program,
- along with some command-line parameters before and after the
- filename. If the oldest file was named MYDATA.DAT, it would be
- as if you typed this command: COPYOLD /v MYDATA.DAT /d/r
-
- EXAMPLE: FORAGE newest *.* testnew @@ -x -y
- FUNCTION: Passes the name of the newest file to the testnew program,
- followed by the command-line parameters. If the oldest file was
- named MYFILE.TXT, it would be as if you typed this command:
- testnew MYFILE.TXT -x -y
-
-
- ============================================================================
- RETURN CODES
- ============================================================================
-
- When you use FORAGE in a batch file, you should use "IF ERRORLEVEL" to check
- if the utility actually found a file.
-
- IMPORTANT: When using "IF ERRORLEVEL", you MUST check the higher values
- first! In other words, check 255 before 1, and 1 before 0.
- This is because of the way "IF ERRORLEVEL" works. See your
- DOS manual for details.
-
- FORAGE sets ERRORLEVEL as follows:
-
-
- ERRORLEVEL REASON
- ---------- ------
-
- 0 No problems -- file was found
-
- 1 No file was found to match the mask
-
- 255 Program error, or help screen was displayed
-
-
- ============================================================================
- SAMPLE BATCH FILES
- ============================================================================
-
- NOTE: This is not a tutorial for batch file programming. To find out more
- about this useful, powerful feature of DOS, consult your DOS manual.
- If you plan to do any batch programming, you should obtain a copy of
- our "SEE Utilities". These can be obtained from our support BBS, or
- can be ordered as part of our "Amazing Shareware Promotion". View or
- print the text file AMAZE.DOC (included with FORAGE) for details.
-
- The FORAGE package includes several sample batch files. These can be viewed
- or edited with a standard text editor program (e.g. DOS EDIT, or a word-
- processor in generic "DOS Text" mode). These batch files are provided for
- study rather than for immediate use. But with a few minor modifications,
- you may find that they're just what you need! The batch files are:
-
- SAVEOLD.BAT Copies the oldest file in the directory with a DAT extension to
- a diskette, then deletes the file.
-
- SAFE.BAT A backup program that uses the PKZIP file compression utility
- (created by Phil Katz of PKWare) to perform a quick and easy
- backup of your current directory. This is ideal for people who
- wish to make safety copies of their work several times per day.
- SAFE maintains up to three backups (in compressed form) on a
- diskette. By using two or more diskettes in this way, you can
- have plenty of backups! It's easy to use SAFE: whenever you
- take a coffee break, just type SAFE and walk away. Now there's
- no reason to be without a backup!
-
- NOTE: The PKZIP utility is NOT included in the FORAGE package,
- but it can be found on almost any BBS in the world. You can
- also call our support BBS and download a fine freeware
- alternative to PKZIP, named LHA. The batch file can then be
- modified to use that compression utility instead.
-
- If you have PKZIP, you can use SAFE immediately. Make sure
- that these files are in your DOS PATH:
-
- --------- Included with FORAGE --------- ---Other---
- FORAGE.EXE SAFE.BAT, PINNACLE.EXE PKZIP.EXE
- GETKEY.EXE SAFE2.BAT PKUNZIP.EXE
- ---------------------------------------- -----------
-
- Then log to a directory on your hard disk. Insert a blank
- diskette in the A: drive, then type SAFE at the DOS prompt.
- This will backup all files. You can also back up a subset by
- entering a file mask. For example: SAFE *.DAT
-
- SAFE2.BAT This is a utility batch file called by SAFE.BAT
-
-
- ============================================================================
- LEGAL NOTICE
- ============================================================================
-
- FORAGE is presented on an "as is" basis, with no warranties or guarantees
- expressed or implied. The user bears complete responsibility for assessing
- the usefulness and applicability of FORAGE to his or her application.
- Under no circumstances will the author accept liability for any damages
- arising from the use or misuse of FORAGE or its accompanying files.
-
-
- ============================================================================
- SHAREWARE
- ============================================================================
-
- FOR ORDERING INFORMATION, PLEASE SEE THE TEXT FILES OPTIONS.DOC & ORDER.FRM.
-
- FORAGE is distributed as SHAREWARE, which means that, while we retain full
- copyright, we encourage you to evaluate the product -- at no cost -- for a
- reasonable period (about 45 days). You are invited to pass around unaltered,
- unregistered copies of the package. See the file VENDOR.DOC (included in
- the FORAGE package) for complete distribution details.
-
- The Turbo Pascal source code for FORAGE may be purchased for in-house use
- only, for $150. You must be a registered FORAGE user to purchase source.
-
-
-
-